]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Add drag actors to the stage before querying their sizes
authorJasper St. Pierre <jstpierre@mecheye.net>
Wed, 26 Sep 2012 15:42:56 +0000 (12:42 -0300)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 2 Oct 2012 19:15:23 +0000 (16:15 -0300)
Drag actors may be St widgets, which require that they're added
to the stage before they have a size.

https://bugzilla.gnome.org/show_bug.cgi?id=684888

js/ui/dnd.js

index 76a86afc15b15a02473ffa65f0f0cf006b572c4a..b99eb45cbc0521846c1ec4a3a569915f961a33e6 100644 (file)
@@ -235,6 +235,10 @@ const _Draggable = new Lang.Class({
 
         if (this.actor._delegate && this.actor._delegate.getDragActor) {
             this._dragActor = this.actor._delegate.getDragActor(this._dragStartX, this._dragStartY);
+            this._dragActor.reparent(Main.uiGroup);
+            this._dragActor.raise_top();
+            Shell.util_set_hidden_from_pick(this._dragActor, true);
+
             // Drag actor does not always have to be the same as actor. For example drag actor
             // can be an image that's part of the actor. So to perform "snap back" correctly we need
             // to know what was the drag actor source.
@@ -263,6 +267,10 @@ const _Draggable = new Lang.Class({
             this._dragOffsetY = this._dragActor.y - this._dragStartY;
         } else {
             this._dragActor = this.actor;
+            this._dragActor.reparent(Main.uiGroup);
+            this._dragActor.raise_top();
+            Shell.util_set_hidden_from_pick(this._dragActor, true);
+
             this._dragActorSource = undefined;
             this._dragOrigParent = this.actor.get_parent();
             this._dragOrigX = this._dragActor.x;
@@ -280,10 +288,6 @@ const _Draggable = new Lang.Class({
                                  scaledHeight / this.actor.height);
         }
 
-        this._dragActor.reparent(Main.uiGroup);
-        this._dragActor.raise_top();
-        Shell.util_set_hidden_from_pick(this._dragActor, true);
-
         this._dragOrigOpacity = this._dragActor.opacity;
         if (this._dragActorOpacity != undefined)
             this._dragActor.opacity = this._dragActorOpacity;